<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增过程')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-object-add">
            <div class="form-group">    
                <label class="col-sm-3 control-label">父对象选择：</label>
                <div class="col-sm-8">
                    <div class="input-group">
                        <input id="treeId" name="parentId" type="hidden" th:value="${objectName?.objectId}"/>
                        <input class="form-control" type="text" onclick="selectObjectTree()" id="treeName" readonly="true" th:value="${objectName?.objectName}">
                        <span class="input-group-addon"><i class="fa fa-search"></i></span>
                    </div>
                </div>
            </div>

            <input id="aType" name="aType" type="hidden">
            <div class="form-group">
                <label class="col-sm-3 control-label">一级对象类型：</label>
                <div class="col-sm-8">
                    <select id='a_object_type' class="form-control m-b" th:with="atype=${@dict.getType('a_object_type')}" onChange="changeProvince()" required>
                        <option value=''>---请选择---</option>
                        <option th:each="dict1 : ${atype}" th:text="${dict1.dictLabel}" th:value="${dict1.dictValue}"></option>
                    </select>
                </div>
            </div>



            <!--<div class="form-group">-->
                <!--<label class="col-sm-3 control-label">二级对象类型：</label>-->
                <!--<div class="col-sm-8">-->
                    <!--<select  id="b_object_type" name="priority" class="form-control m-b" th:with="type=${@dict.getType('b_object_type')}">-->
                        <!--<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" ></option>-->
                    <!--</select>-->
                <!--</div>-->
            <!--</div>-->


            <div class="form-group">
                <label class="col-sm-3 control-label">二级对象类型：</label>
                <div class="col-sm-8">
                    <select  id="c_object_type" name="bType" class="form-control m-b" onChange="changeobject_type()" required>

                    </select>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-3 control-label">对象名称：</label>
                <div class="col-sm-8">
                    <input name="objectName"  class="form-control" type="text" required>
                </div>
            </div>



            <!--优先级1（下拉框）接触点对象属性-->

            <div class="form-group" id="j1" style="display:none;">
                <label class="col-sm-3 control-label">优先级：</label>
                <div class="col-sm-8">
                    <select name="priority" class="form-control m-b" th:with="type=${@dict.getType('item_attribute_priority')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictLabel}"></option>
                    </select>
                </div>
            </div>

            <!--IP地址 IP地址属性-->
            <div class="form-group" id="j2" style="display:none;">
                <label class="col-sm-3 control-label">IP地址：</label>
                <div class="col-sm-8">
                    <input name="ipAddress" class="form-control" type="text">
                </div>
            </div>
            <!--域名  IP地址属性-->
            <div class="form-group"  id="j3"style="display:none;">
                <label class="col-sm-3 control-label">域名：</label>
                <div class="col-sm-8">
                    <input name="domainName" class="form-control" type="text">
                </div>
            </div>
            <!--端口2（单行文本）接触点对象属性-->
            <div class="form-group" id="j4" style="display:none;">
                <label class="col-sm-3 control-label">端口：</label>
                <div class="col-sm-8">
                    <input name="ipPort" class="form-control" type="text">
                </div>
            </div>
            <!--服务3（单行文本）接触点对象属性-->
            <div class="form-group" id="j5" style="display:none;">
                <label class="col-sm-3 control-label">服务：</label>
                <div class="col-sm-8">
                    <input name="service" class="form-control" type="text">
                </div>
            </div>
            <!--访问方式（单行文本）接触点对象属性-->
            <div class="form-group" id="j6" style="display:none;">
                <label class="col-sm-3 control-label">访问方式：</label>
                <div class="col-sm-8">
                    <textarea name="uri" class="form-control"></textarea>
                </div>
            </div>
            <!--账号口令（单行文本）接触点对象属性-->
            <div class="form-group" id="j7" style="display:none;">
                <label class="col-sm-3 control-label">账号口令：</label>
                <div class="col-sm-8">
                    <textarea name="accountPass" class="form-control"></textarea>
                </div>
            </div>
            <!--版本信息（单行文本）接触点对象属性-->
            <div class="form-group" id="j8" style="display:none;">
                <label class="col-sm-3 control-label">版本信息：</label>
                <div class="col-sm-8">
                    <input name="version" class="form-control" type="text">
                </div>
            </div>
            <!--登陆点（单行文本）接触点对象属性-->
            <div class="form-group" id="j9" style="display:none;">
                <label class="col-sm-3 control-label">有无登录点：</label>
                <div class="col-sm-8" >
                    <select name="loginPoint" class="form-control m-b" th:with="type=${@dict.getType('login_face')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                    </select>
<!--                    <textarea name="loginFace" class="form-control"></textarea>-->
                </div>
            </div>
            <!--登陆方式（单行文本）接触点对象属性-->
            <div class="form-group" id="j10" style="display:none;">
                <label class="col-sm-3 control-label">登录方式：</label>
                <div class="col-sm-8">
                    <textarea name="loginMode" class="form-control"></textarea>
                </div>
            </div>
            <!--控制台类型（单行文本）接触点对象属性-->
            <div class="form-group" id="j11" style="display:none;">
                <label class="col-sm-3 control-label">控制台类型：</label>
                <div class="col-sm-8">
                    <select name="consoleType" class="form-control m-b" th:with="type=${@dict.getType('item_attribute_console_type')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                    </select>
                </div>
            </div>
            <!--下载地址（单行文本）接触点对象属性-->
            <div class="form-group" id="j12" style="display:none;">
                <label class="col-sm-3 control-label">下载地址：</label>
                <div class="col-sm-8">
                    <textarea name="download" class="form-control"></textarea>
                </div>
            </div>
            <!--风险等级（单行文本）接触点对象属性-->
            <div class="form-group" id="j13" style="display:none;">
                <label class="col-sm-3 control-label">风险等级：</label>
                <div class="col-sm-8">
                    <select name="riskLevel" class="form-control m-b" th:with="type=${@dict.getType('item_attribute_risk_level')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                    </select>
                </div>
            </div>
            <!--验证情况（单行文本）接触点对象属性-->
            <div class="form-group" id="j14" style="display:none;">
                <label class="col-sm-3 control-label">验证情况：</label>
                <div class="col-sm-8">
                    <select name="verification" class="form-control m-b" th:with="type=${@dict.getType('item_attribute_verification')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                    </select>
                </div>
            </div>
            <!--漏洞类型（单行文本）接触点对象属性-->
            <div class="form-group" id="j15" style="display:none;">
                <label class="col-sm-3 control-label">漏洞类型：</label>
                <div class="col-sm-8">
                    <input name="vulner" class="form-control" type="text">
                </div>
            </div>
            <!--CVE编号（单行文本）接触点对象属性******-->
            <div class="form-group" id="j16" style="display:none;">
                <label class="col-sm-3 control-label">CVE编号：</label>
                <div class="col-sm-8">
                    <input name="cveId" class="form-control" type="text">
                </div>
            </div>
            <!--WEB漏洞类型 接触点对象属性******-->
            <div class="form-group" id="j17" style="display:none;">
                <label class="col-sm-3 control-label">WEB漏洞类型：</label>
                <div class="col-sm-8">
                    <select id='web_vulner' name="priority" class="form-control m-b" th:with="atype=${@dict.getType('web_vulner')}">
                        <option th:each="dict1 : ${atype}" th:text="${dict1.dictLabel}" th:value="${dict1.dictValue}"></option>
                    </select>
                </div>
            </div>
            <!--漏洞位置 接触点对象属性******-->
            <div class="form-group" id="j18" style="display:none;">
                <label class="col-sm-3 control-label">漏洞位置：</label>
                <div class="col-sm-8">
                    <textarea name="position" class="form-control"></textarea>
                </div>
            </div>

            <!--请求链接 接触点对象属性******-->
            <div class="form-group" id="j19" style="display:none;">
                <label class="col-sm-3 control-label">请求链接：</label>
                <div class="col-sm-8">
                    <textarea name="reqLink" class="form-control"></textarea>
                </div>
            </div>
            <!--关键参数 接触点对象属性******-->
            <div class="form-group" id="j20" style="display:none;">
                <label class="col-sm-3 control-label">关键参数：</label>
                <div class="col-sm-8">
                    <input name="keyPara" class="form-control" type="text">
                </div>
            </div>

            <!--请求信息 接触点对象属性******-->
            <div class="form-group" id="j21" style="display:none;">
                <label class="col-sm-3 control-label">请求信息：</label>
                <div class="col-sm-8">
                    <textarea name="reqInfo" class="form-control"></textarea>
                </div>
            </div>
            <!--响应信息 接触点对象属性******-->
            <div class="form-group" id="j22" style="display:none;">
                <label class="col-sm-3 control-label">响应信息：</label>
                <div class="col-sm-8">
                    <textarea name="resInfo" class="form-control"></textarea>
                </div>
            </div>

            <!--后渗透对象对象属性****** 未添加数据库-->
            <div class="form-group" id="j23" style="display:none;">
                <label class="col-sm-3 control-label">后渗透对象访问方式：</label>
                <div class="col-sm-8">
                    <textarea name="afterObject" class="form-control"></textarea>
                </div>
            </div>
            <div class="form-group" id="j24" style="display:none;">
                <label class="col-sm-3 control-label">数据敏感度：</label>
                <div class="col-sm-8">
                    <select name="sensitivity" class="form-control m-b" th:with="type=${@dict.getType('item_attribute_sensitivity')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group" id="j25" style="display:none;">
                <label class="col-sm-3 control-label">数据规模：</label>
                <div class="col-sm-8">
                    <input name="dataSize" class="form-control" type="text">
                </div>
            </div>






            <!--备注0（多行文本）接触点对象属性 组织对象-->
            <div class="form-group"  style="display:block;">
                <label class="col-sm-3 control-label">备注：</label>
                <div class="col-sm-8">
                    <textarea name="remark" class="form-control"></textarea>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script type="text/javascript">
        var prefix = ctx + "system/object"
        $("#form-object-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-object-add').serialize());
            }
        }

        /*过程-新增-选择父部门树*/
        function selectObjectTree() {
            var options = {
                title: '过程选择',
                width: "380",
                url: prefix + "/selectObjectTree/" + $("#treeId").val(),
                callBack: doSubmit
            };
            $.modal.openOptions(options);
        }

        function doSubmit(index, layero){
            var body = layer.getChildFrame('body', index);
               $("#treeId").val(body.find('#treeId').val());
               $("#treeName").val(body.find('#treeName').val());
               layer.close(index);
        }

        function changeProvince(){
            var object_type = ($("#a_object_type option:selected").val());
            var type = object_type.split(",");
//            var checkText=$("#a_object_type").find("option:selected").text();
            var checkText2=$("#a_object_type").find("option:selected").text();
            $("#aType").val(checkText2);



//            {
//                alert(checkText);
//                document.getElementById('j1').style.display="block";
//                document.getElementById('j2').style.display="block";
//                document.getElementById('j3').style.display="block";
//            }

//            var text= object_type.text();

//            var c_object_type = document.getElementById("c_object_type");
//            var object_type = document.getElementById('a_object_type').options.val();
            $("#c_object_type").empty();
            $("#c_object_type").append("<option value=''>---请选择---</option>");
            for(var j=0;j<type.length;j++)
                $("#c_object_type").append("<option value='"+type[j]+"'>"+type[j]+"</option>");

            // $("#a_object_type").val("5555555555555555");





//
//                c_object_type.options.add(new options("text",type[j]))
//            alert(text[0]);
//            if(checkText2 == '组织对象'){
//                document.getElementById('j1').style.display="block";
//                document.getElementById('j2').style.display="block";
//
//            }


        }
        function changeobject_type() {
            var b_object_type = ($("#b_object_type option:selected").val());
//            var b_type = object_type.split(",");
//            alert(b_object_type[0]);
//            document.getElementById(b_object_type[0]).style.display="block";
            var checkText2=$("#c_object_type").find("option:selected").text();
            document.getElementById('j1').style.display="none";
            document.getElementById('j2').style.display="none";
            document.getElementById('j3').style.display="none";
            document.getElementById('j4').style.display="none";
            document.getElementById('j5').style.display="none";
            document.getElementById('j6').style.display="none";
            document.getElementById('j7').style.display="none";
            document.getElementById('j8').style.display="none";
            document.getElementById('j9').style.display="none";
            document.getElementById('j10').style.display="none";
            document.getElementById('j11').style.display="none";
            document.getElementById('j12').style.display="none";
            document.getElementById('j13').style.display="none";
            document.getElementById('j14').style.display="none";
            document.getElementById('j15').style.display="none";
            document.getElementById('j16').style.display="none";
            document.getElementById('j17').style.display="none";
            document.getElementById('j18').style.display="none";
            document.getElementById('j19').style.display="none";
            document.getElementById('j20').style.display="none";
            document.getElementById('j21').style.display="none";
            document.getElementById('j22').style.display="none";
            document.getElementById('j23').style.display="none";
            document.getElementById('j24').style.display="none";
            document.getElementById('j25').style.display="none";


            if(checkText2 == '组织对象'){
                document.getElementById('j1').style.display="block";

            }
            if(checkText2 == 'IP地址'){
                document.getElementById('j2').style.display="block";
                document.getElementById('j3').style.display="block";

            }

            if(checkText2 == '服务' || checkText2 == 'VPN'){
                document.getElementById('j1').style.display="block";
                document.getElementById('j4').style.display="block";
                document.getElementById('j5').style.display="block";
                document.getElementById('j6').style.display="block";
                document.getElementById('j7').style.display="block";
                document.getElementById('j8').style.display="block";
            }
            if(checkText2 == '网站'){
                document.getElementById('j1').style.display="block";
                document.getElementById('j4').style.display="block";
                document.getElementById('j5').style.display="block";
                document.getElementById('j6').style.display="block";
                document.getElementById('j7').style.display="block";
                document.getElementById('j8').style.display="block";
                document.getElementById('j9').style.display="block";
                document.getElementById('j10').style.display="block";
            }
            if(checkText2 == '控制台'){
                document.getElementById('j1').style.display="block";
                document.getElementById('j4').style.display="block";
                document.getElementById('j5').style.display="block";
                document.getElementById('j6').style.display="block";
                document.getElementById('j7').style.display="block";
                document.getElementById('j8').style.display="block";
                document.getElementById('j11').style.display="block";
            }
            if(checkText2 == 'APP'){
                document.getElementById('j1').style.display="block";
                document.getElementById('j4').style.display="block";
                document.getElementById('j5').style.display="block";
                document.getElementById('j6').style.display="block";
                document.getElementById('j7').style.display="block";
                document.getElementById('j8').style.display="block";
                document.getElementById('j12').style.display="block";
            }

            if(checkText2 == '客户端漏洞'){
                document.getElementById('j13').style.display="block";
                document.getElementById('j14').style.display="block";
                document.getElementById('j15').style.display="block";
            }
            if(checkText2 == '系统漏洞'){
                document.getElementById('j13').style.display="block";
                document.getElementById('j14').style.display="block";
                document.getElementById('j16').style.display="block";
                document.getElementById('j6').style.display="block";

            }
            if(checkText2 == 'WEB应用漏洞'){
                document.getElementById('j13').style.display="block";
                document.getElementById('j14').style.display="block";
                document.getElementById('j17').style.display="block";
                document.getElementById('j18').style.display="block";
                document.getElementById('j19').style.display="block";
                document.getElementById('j20').style.display="block";
                document.getElementById('j21').style.display="block";
                document.getElementById('j22').style.display="block";
            }
            if(checkText2 == 'webshell' || checkText2 == '命令行' || checkText2 == '桌面'){
                document.getElementById('j7').style.display="block";
                document.getElementById('j23').style.display="block";

            }
            if(checkText2 == '无'){
                document.getElementById('j24').style.display="block";
                document.getElementById('j25').style.display="block";

            }








        }

    </script>
</body>
</html>